<?php

class DailyFirstLoginPreHandler extends Fs2PreHandler
{

    /**
     * @see SzAbstractCtrlPreProcessHandler::handle
     *
     * @param array $inputs passed by reference, params inputted from $_REQUEST['*']
     * @return boolean
     * @throws 20073
     */
    public function handle(&$inputs)
    {
        if ($this->checkHandleExclude($inputs, ['game' => ['init']])) {
            //game.init会执行handleLogin不需要执行此handler
            return true;
        }

        $userId = $this->parseUserId($inputs);
        if ($userId > 0) {
            if (GameService::get()->isDailyFirstLogin($userId) == true) {
                GameService::get()->handleLogin($userId, null, true);
            }
        } else {
            throw new SzException(20073);
        }
        return true;
    }

}